<template>
  <div class="Container">
    <div class="main">
      <div class="title">
        <div class="text" v-if="custom">
          {{ title }}
        </div>
        <div class="text" v-else>{{ title }}</div>
        <div class="slot">
          <slot name="title-right" />
        </div>
      </div>
      <div class="body">
        <slot />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ContainerCenterTitle',
  props: {
    title: {
      type: String,
      default: ''
    },
    custom: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style scoped lang='less'>
@TitleHeight: 45px;
@point: linear-gradient(0, #8d9fbd 0%, #8d9fbd 100%);
@line: linear-gradient(
  270deg,
  rgba(160, 180, 205, 0.24) 0%,
  rgba(103, 125, 159, 0.63) 100%
);
.Container {
  padding: 5px 10px;
  position: relative;
  // height: 100%;
  width: 100%;
  height: 100%;
  .main {
    height: 100%;
    width: 100%;
    /*background: linear-gradient(180deg, #20233A 0%, #242942 100%);*/
    // background: linear-gradient(
    //   180deg,
    //   rgba(32, 35, 58, 0.5) 0%,
    //   rgba(36, 41, 66, 0.5) 100%
    // );
    padding: 10px 10px 5px 10px;

    .title {
      height: @TitleHeight;
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
      justify-content: space-between;
      //   background: @point 0 0 no-repeat, @point 100% 0 no-repeat,
      //     @point 0 100% no-repeat, @point 100% 100% no-repeat,
      //     @line 5px 2px no-repeat, @line 5px calc(~"100% - 2px") no-repeat,
      //     linear-gradient(
      //         270deg,
      //         rgba(51, 75, 115, 0) 0%,
      //         rgba(51, 75, 115, 0.365) 100%
      //       )
      //       center no-repeat;
      background: url(./img/caiwu_title.png) no-repeat;
      background-size: 90% 100%;
      .text {
        text-indent: 60px;
        // line-height: @TitleHeight;
        line-height: 40px;

        font-size: 25px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        color: #FFFFFF;

        background: linear-gradient(0deg, #8CD9FD 0%, #DBF4FF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }

      .slot {
        padding: 3px 5px;

        > * {
          height: 100%;
        }
      }

      > div {
        flex-basis: auto;
      }
    }

    .body {
      margin-top: 3px;
      height: calc(-@TitleHeight + ~"-3px + 100%");
    }
  }
}
</style>
